package cn.hiapi.shopkeeper.entity.shopkeeper;

import cn.hiapi.basic.entity.BasicEntity;
import cn.hiapi.basic.serializer.LongToStringSerializer;
import cn.hiapi.utils.DateUtils;
import com.alibaba.fastjson.annotation.JSONField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;
import java.util.Date;

/**
 * @author AdinZ
 * @date 2023/1/31 23:34
 */
@Entity
@Table(name = "hiapi_shopkeeper_shop_user")
@ApiModel(description = "在本店铺中消费过的用户")
@Getter
@Setter
public class ShopUser extends BasicEntity {
    @Id
    @GeneratedValue(generator = "snowflake")
    @GenericGenerator(name = "snowflake", strategy = "cn.hiapi.basic.id.SnowflakeId")
    @JSONField(serializeUsing = LongToStringSerializer.class)
    private Long id;


    @ApiModelProperty("店铺id")
    private long shopId;
    @ApiModelProperty("砍价用户")
    private long uid;

    private long aid;

    @ApiModelProperty("性别")
    private int gender;

    @ApiModelProperty("生日")
    private long birthday;

    private String remark;


    @ApiModelProperty("年")
    @Column(name = "_year", length = 10)
    private String year = DateUtils.format("yyyy");

    @ApiModelProperty("月")
    @Column(name = "_month", length = 10)
    private String month = DateUtils.format("yyyy-MM");

    @ApiModelProperty("日")
    @Column(name = "_day", length = 10)
    private String day = DateUtils.format("yyyy-MM-dd");

    @ApiModelProperty("创建时间")
    private long created = System.currentTimeMillis();

    @ApiModelProperty("更新时间")
    private long updated = System.currentTimeMillis();

}
